package com.ryan.mms.position.model;

// Generated 2011-11-27 20:38:40 by Hibernate Tools 3.4.0.CR1

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.ryan.framework.model.Model;
import com.ryan.mms.privilage.model.Employee;

/**
 * Position generated by hbm2java
 */
@Entity
@Table(name = "position")
public class Position implements Model {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private Long positionId;
	private String positionName;
	private String meno;
	private Date creationDate;
	private Integer creator;
	private List<Employee> employees;
	
	public Position() {
	}

	public Position(Long positionId) {
		this.positionId = positionId;
	}

	public Position(Long positionId, String positionName, String meno,
			Date creationDate, Integer creator) {
		this.positionId = positionId;
		this.positionName = positionName;
		this.meno = meno;
		this.creationDate = creationDate;
		this.creator = creator;
	}

	@Id
	@Column(name = "position_id", unique = true, nullable = false)
	public Long getPositionId() {
		return this.positionId;
	}

	public void setPositionId(Long positionId) {
		this.positionId = positionId;
	}

	@Column(name = "position_name", length = 30)
	public String getPositionName() {
		return this.positionName;
	}

	public void setPositionName(String positionName) {
		this.positionName = positionName;
	}

	@Column(name = "meno", length = 1024)
	public String getMeno() {
		return this.meno;
	}

	public void setMeno(String meno) {
		this.meno = meno;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "creationDate", length = 19)
	public Date getCreationDate() {
		return this.creationDate;
	}

	public void setCreationDate(Date creationDate) {
		this.creationDate = creationDate;
	}

	@Column(name = "creator")
	public Integer getCreator() {
		return this.creator;
	}

	public void setCreator(Integer creator) {
		this.creator = creator;
	}

	@ManyToMany (
		targetEntity=Employee.class,cascade={CascadeType.PERSIST,CascadeType.MERGE}
	)
	@JoinTable(
		name="employee_position",
		joinColumns={@JoinColumn(name="position_id")},
		inverseJoinColumns={@JoinColumn(name="employee_id")}
	)
	public List<Employee> getEmployees() {
		return employees;
	}

	public void setEmployees(List<Employee> employees) {
		this.employees = employees;
	}

}
